home *** CD-ROM | disk | FTP | other *** search
/ APDL Other Worlds / APDL Other Worlds Collection.iso / SF3000 / Extras / !SFskyedit / c / SFSFileInfo < prev    next >
Encoding:
Text File  |  2003-10-16  |  2.5 KB  |  72 lines

  1. /*
  2.  *  SFskyedit - Star Fighter 3000 sky colours editor
  3.  *  File info window
  4.  *  Copyright (C) 2001  Chris Bazley
  5.  *
  6.  *  This program is free software; you can redistribute it and/or modify
  7.  *  it under the terms of the GNU General Public Licence as published by
  8.  *  the Free Software Foundation; either version 2 of the Licence, or
  9.  *  (at your option) any later version.
  10.  *
  11.  *  This program is distributed in the hope that it will be useful,
  12.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  *  GNU General Public Licence for more details.
  15.  *
  16.  *  You should have received a copy of the GNU General Public Licence
  17.  *  along with this program; if not, write to the Free Software
  18.  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  */
  20.  
  21. /* RISC OS library files */
  22. #include "toolbox.h"
  23. #include "fileinfo.h"
  24. #include "event.h"
  25.  
  26. /* My library files */
  27. #include "err.h"
  28. #include "msgtrans.h"
  29. #include "Macros.h"
  30.  
  31. /* Local headers */
  32. #include "EditSky.h"
  33. #include "SFSFileInfo.h"
  34.  
  35. ObjectId fileinfo_sharedid = NULL_ObjectId;
  36.  
  37. /* ----------------------------------------------------------------------- */
  38. /*                       Function prototypes                               */
  39.  
  40. static ToolboxEventHandler _FileInfo_abouttoopen;
  41.  
  42. /* ----------------------------------------------------------------------- */
  43. /*                         Public functions                                */
  44.  
  45. void FileInfo_initialise(IdBlock *id_block)
  46. {
  47.   fileinfo_sharedid = id_block->self_id;
  48.  
  49.   /* file type is constant */
  50.   EF(fileinfo_set_file_type(0, fileinfo_sharedid, FILETYPE_SKYCOLS));
  51.  
  52.   EF(event_register_toolbox_handler(fileinfo_sharedid, FileInfo_AboutToBeShown, _FileInfo_abouttoopen, NULL));
  53. }
  54.  
  55. /* ----------------------------------------------------------------------- */
  56. /*                         Private functions                               */
  57.  
  58. static int _FileInfo_abouttoopen(int event_code, ToolboxEvent *event, IdBlock *id_block, void *handle)
  59. {
  60.   ViewData *view_data;
  61.  
  62.   E_RETV(toolbox_get_client_handle(0, id_block->ancestor_id, (void **)&view_data), 1);
  63.  
  64.   /* Set up contents */
  65.   RE(fileinfo_set_file_size(0, fileinfo_sharedid, sizeof(SF_SkyColours)));
  66.   RE(fileinfo_set_modified(0, id_block->self_id, view_data->changed_since_save));
  67.   RE(fileinfo_set_file_name(0, id_block->self_id, view_data->last_savepath));
  68.   RE(fileinfo_set_date(0, id_block->self_id, view_data->file_date));
  69.  
  70.   return 1; /* claim event */
  71. }
  72.